import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:study_flutter/home/thridLabary/chart_draw.dart';
import 'package:study_flutter/home/thridLabary/loadImage.dart';
import 'package:study_flutter/home/thridLabary/thridLabaryPratice.dart';

class HomePage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _HomeState();
  }

}

class _HomeState extends State<HomePage>{

  List<String> list = ["图片加载","第二条","图形绘制"];

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("首页"),
      ),
      body: Container(
        color: Colors.red,
        child: ListView.builder(
          shrinkWrap: true,
          itemCount: list.length,
            itemBuilder: (BuildContext context, int index){
              return GestureDetector(
                onTap: (){
                  if (index == 0){
                    Navigator.push(context, MaterialPageRoute(builder: (BuildContext contex){
                      return ThridLabaryPage();
                    }));
                  }else if (index == 2){
                    Navigator.push(context, MaterialPageRoute(builder: (BuildContext contex){
                      return ChartPage();
                    }));
                  }},
                child: Container(
                  child: Text(
                    list[index],
                  ),
                  height: 50,
                ),
              );
            })
      ),
    );
  }

}